<?php
namespace Home\Controller;

use Utuo\ForegroundController;

class HaggleController extends ForegroundController {
	
	public function _init() {
		layout(false);
		$this->setModelName("Site");
	}
	
	/**
	 * 提问表单
	 */
	public function indexAction() {
		C("TOKEN_ON", true);
		$this->assign("haggleShopList", M("HaggleShop")->select());
		$this->display("Site/Haggle/index");
	}
	
	/**
	 * 表单提交
	 */
	public function saveAction() {
		C("TOKEN_ON", true);
		$m = D("Haggle");
		if($m->create()) {
			$m->create_time = time();
			$m->cid = $this->cid;
			false !== $m->add() and $this->ajaxSuccess('提交成功');
		}
		$this->ajaxError($m->getError());
	}
	
}